//
//  LMRootTool.m
//  李明微博
//
//  Created by 张青花 on 15/12/9.
//  Copyright (c) 2015年 李明. All rights reserved.
//

#import "LMRootTool.h"
#import "LMTabBarController.h"
#import "LMNewFeatureViewController.h"
@implementation LMRootTool


+ (void)setroot:(UIWindow *)window
{
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
    
    NSString *lastVersion = [[NSUserDefaults standardUserDefaults] objectForKey:@"LMVersionKey"];
    
    
    
    if ([currentVersion isEqualToString:lastVersion]) {
        LMTabBarController *tab = [[LMTabBarController alloc] init];
        tab.view.backgroundColor = [UIColor lightGrayColor];
        window.rootViewController = tab;
        
    }
    else
    {
        
        LMNewFeatureViewController *new = [[LMNewFeatureViewController alloc] init];
        
        window.rootViewController = new;
        [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:@"LMVersionKey"];
        [[NSUserDefaults standardUserDefaults] synchronize];
        
    }
    
}
@end
